<template>
  <div class="app-container calendar-list-container">
    <search :list="queryList" :queryEntity="queryEntity"></search>
    <buttons :showQuery="true" :showBack="false" @query="doQuery" :list="btnList" :disabled="disabled" placeholder="订单号" :permissions="permissions">
    </buttons>
    <grid gridTitle="验布信息" :url="url" :columns="columns" :enableEdit="false" :loading="true" ref="mainGrid" height="auto" diffHeight="245" :pagination="false"
      :permissions="permissions" :multi="false" @change="rowCilck" :queryEntity="queryEntity" @in="doIn">
    </grid>
  </div>
</template>
<script>
import request from '@/router/axios'
import { Message, MessageBox } from 'element-ui'
import url from '@/const/apiURL'
import grid from '@/components/Grid'
import buttons from '@/components/Buttons'
import { mapGetters } from 'vuex'
import { BusinessOrderStatusFormatter, BusinessTypeFormatter, YesOrNoFormatter } from '@/const/dict'
import search from '@/components/Search'
import { colunms } from '@/const/colunms'
import { dict } from '@/const/dict'
import { queryField } from '@/const/query'
import { formData } from '@/const/formData'
import 'bpmn-js/dist/assets/diagram-js.css';
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'

export default {
  components: { grid, buttons, search },
  data () {
    return {
      searchText: '',
      numberSize: 5,
      orderNo: '',
      url: url.BUSINESS_QUICK_IN_BUSINESS_URL,
      entity: {},
      queryEntity: { key: 'key' },
      disabled: true,
      columns: [
        {
          label: '操作', width: 100, prop: 'op', align: 'center', template: 'op', opList: [
            { name: '入库', clickName: 'in', auth: 'yes' }
          ]
        },
        { label: '大货订单', width: 180, prop: 'orderNo', align: 'center' },
        { label: '工序', width: 140, prop: 'stepName', align: 'center' },
        { label: '客户名称', width: 200, prop: 'customerName', align: 'center' },
        { label: '物料名称', width: 360, prop: 'goodsName', align: 'left' },
        { label: this.global.modelName, width: 100, prop: 'modelName', align: 'center' },
        { label: this.global.modelProp, width: 100, prop: 'modelProp', align: 'center' }
      ],
      btnList: [

      ],
      queryList: [
        { name: '订单编号', type: 'query', prop: 'orderNo', rowValue: 'orderNo', rowName: 'orderNo', url: url.ORDER_LIST_URL, columns: colunms().orderColumns, pagination: true, queryList: queryField().order, queryEntity: { status: 1 }, autoInput: true },
        { name: '工序', type: 'query', prop: 'stepCode', rowValue: 'stepCode', rowName: 'stepName', url: url.STEP_LIST_URL, columns: colunms().stepColumns, pagination: true, queryList: queryField().step, queryEntity: { status: 1 } },
        { name: '客户名称', type: 'query', prop: 'customerCode', rowValue: 'customerCode', rowName: 'customerName', url: url.CUSTOMER_LIST_URL, columns: colunms().customerColumns, pagination: true, queryList: queryField().customer, queryEntity: { customerType: 'HANDLE' } },
      ]
    }
  },
  mounted () {
  },
  created () {
    this.code = this.$route.query.code
  },
  computed: {
    ...mapGetters(['permissions'])
  },
  methods: {
    doQuery (text) {
      this.$refs['mainGrid'].doQuery(text)
    },
    rowCilck (row) {
      this.disabled = row.length == 0
    },
    doIn (row) {
      if (row.goodsCode == 'All') {
        this.$router.push({ path: '/prod/business/all', query: { code: row.orderStepCode, goodsCode: row.goodsCode, orderNo: row.orderNo } })
      } else {
        this.$router.push({ path: '/prod/business', query: { code: row.orderStepCode, goodsCode: row.goodsCode, orderNo: row.orderNo } })
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.w-body {
  padding-top: 8px;
}
.w-table {
  border: 1px solid #ebeef5;
}
.w-table-title {
  border: 1px solid #ebeef5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-all;
  line-height: 23px;
  display: inline-block;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  position: relative;
  vertical-align: middle;
  width: 100%;
  font-size: 14px;
  color: gray;
}
.input-box {
  clear: both;
  width: 450px;
}
.number-box {
  clear: both;
  width: 220px;
}
.btn-slot-box {
  padding-top: -15px;
}
</style>
